﻿using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
internal class FuckProtect {
    private static byte[] bytes;
    static FuckProtect()//构造函数
    {
        Assembly assembly = typeof(FuckProtect).Assembly;
        RSACryptoServiceProvider.UseMachineKeyStore = true;
        BinaryReader binaryReader = new BinaryReader(assembly.GetManifestResourceStream("hconnect.db"));
        binaryReader.BaseStream.Position = 0L; // 流文件初始位置
        bytes = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length);
        binaryReader.Close();
    }
   public static string DataFrom(int Startindexs)//读取数据文件
   {
        if (FuckProtect.bytes.Length == 0) {
        }
        int count = BitConverter.ToInt32(FuckProtect.bytes,Startindexs);//由四个字节构成、从 startIndex 开始的 32 位有符号整数
        try {
            return Encoding.Unicode.GetString(FuckProtect.bytes,Startindexs + 4,count);//indexs 第一个 count 数量
        } catch {
        }
        return "";
    }
}
